<template>
  <div class="main">
    <el-container class="box">
      <el-aside :width="changeStowVal ? '60px' : '210px'" class="pages-aside">
        <navMenu :isStow="changeStowVal"></navMenu>
      </el-aside>
      <el-container class="pages">
        <el-header class="pages-header">
          <navHeader @changeStow="monitorStow"></navHeader>
        </el-header>
        <el-main class="pages-content">
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import navMenu from '@/components/nav-menu/nav-menu.vue'
import navHeader from '@/components/nav-header/nav-header.vue'
export default defineComponent({
  components: {
    navMenu,
    navHeader
  },
  name: 'mainPage',
  setup() {
    const changeStowVal = ref(false)
    const monitorStow = (isStow: boolean) => {
      changeStowVal.value = isStow
    }
    return {
      monitorStow,
      changeStowVal
    }
  }
})
</script>

<style lang="less" scoped>
.main {
  height: 100%;

  .box {
    height: 100%;

    .pages-aside {
      background: #0f234f;
      transition: width 0.15s;
      -webkit-transition: width 0.15s;
      -moz-transition: width 0.15s;
      -webkit-transition: width 0.15s;
      -o-transition: width 0.15s;
    }
    .pages-header {
      height: 40px;
      line-height: 40px;
      background: #fff;
    }
    .pages-content {
      background: #f2f3f5;
    }
  }
}
</style>
